﻿#ifndef XRTCCLIENT_BASE_XRTC_PREVIEW_H_
#define XRTCCLIENT_BASE_XRTC_PREVIEW_H_

#include <rtc_base/thread.h>

#include "xrtc/ixrtc_preview.h"
#include "xrtc/ixrtc_media_source.h"
#include "xrtc/xrtc_defines.h"
#include "render/d3d9_render.h"

namespace xrtc {

class XRTCPreview : public IXRTCPreview {
public:
    void Start() override;
    void Stop() override;
    void Resize() override;

private:
    XRTCPreview(rtc::VideoSourceInterface<webrtc::VideoFrame>*, 
        const XRTCCanvas& canvas);
    ~XRTCPreview() override;

private:
    rtc::Thread* current_thread_;
    std::unique_ptr<D3D9Render> d3d9_render_;
    bool running_ = false;

    friend class XRTCEngine;
};

} // namespace xrtc


#endif // XRTCCLIENT_BASE_XRTC_PREVIEW_H_